//第一次c++程序

//2024年3月7日

#include <iostream>

using namespace std;
//1.打印乘法口诀表

int main()
{
	int i = 0;
	for (i = 1; i <= 9; i++)
	{
		int j = 0;
		for (j = 1; j <= i; j++)
		{
			cout <<" " << j << "* " << i << " = " << i * j;
		}
		cout << endl;
	}
	return 0;
}

//2.使用引用类型作为输出型参数，设计函数返回整型数组中最大值和最小值

void Add(int *nums,int numsSize,int &retmax, int &retmin)
{
	retmax = nums[0];
	retmin = nums[0];
	
	int i = 0;
	for (i = 0; i < numsSize; i++)
	{
		if (nums[i] > retmax)
		{
			retmax = nums[i];
		}
		if (nums[i] < retmin)
		{
			retmin = nums[i];
		}
	}
}

int main()
{
	int nums[] = { 2,3,5,1,7,8 };
	int numsSize = sizeof(nums) / sizeof(nums[0]);
	int retmax = 0;
	int retmin = 0;
	Add(nums,numsSize,retmax, retmin);
	cout << "最大值为：" << retmax << "最小值为：" << retmin << endl;
}